package com.huixh.train.member.controller;

import com.huixh.train.common.context.LoginMemberContext;
import com.huixh.train.common.resp.PageResult;
import com.huixh.train.member.req.TicketQueryReq;
import com.huixh.train.member.resp.TicketQueryResp;
import com.huixh.train.member.service.TicketService;
import jakarta.annotation.Resource;
import jakarta.validation.Valid;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
* @author huixh
*/
@Validated
@RestController
@RequestMapping("/ticket")
public class TicketController {
    @Resource
    private TicketService ticketService;

    @PostMapping("/query-list")
    public PageResult<List<TicketQueryResp>> query(@Valid TicketQueryReq req) {
        req.setMemberId(LoginMemberContext.getMemberId());
        return ticketService.queryList(req);
    }
}